﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using IHISCETeim.Library;
using System.Data;
using IHISCETeim.BLL;
using System.Text;



namespace IHISCETeim.Web.MachineSys.FTradeModel
{
    public partial class Report9FTradeInterestIncomeDetail : EasyUIPageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get
            {
                return "Report9FTrade";
            }
        }

        protected string JingXiaoShang
        {
            get
            {
                return GetRequestValue<string>("JingXiaoShang", "");
            }
        }

        protected DateTime XiaoShouShiJian {
            get {
                return GetRequestValue<DateTime>("XiaoShouShiJian", DateTime.Now);
            }
        }

        protected string XiaoShouShiJianFrom
        {
            get
            {               
                return XiaoShouShiJian.ToString("yyyy-MM-01");
            }
        }
        /// <summary>
        /// 月最后一天
        /// </summary>
        protected string XiaoShouShiJianTo
        {
            get
            {  
                return Convert.ToDateTime(XiaoShouShiJian.AddMonths(1).ToString("yyyy-MM-01")).AddDays(-1).ToString("yyyy-MM-dd");
            }
        }

        protected string GetSqlwhere()
        {
            return string.Format(" a.XiaoShouShiJian between '{0}' and '{1}' and a.JingXiaoShang='{2}'", XiaoShouShiJianFrom, XiaoShouShiJianTo, JingXiaoShang);
        }
        private DataTableCollection _dts = null;
        protected DataTableCollection dts
        {
            get
            {
                if (_dts == null)
                {
                    _dts = FTradeReportController.Report9GetReportDate(GetSqlwhere(),2);
                }
                return _dts;
            }
        }
        protected override string query()
        {
            return ToDataGridJson(dts[0], TotalCount, null).ToString();
            //return "";
        }
    }
}